package com.topjia.music.user.file.config;

import com.topjia.music.user.file.FileClient;
import com.topjia.music.user.file.impl.HwOBSFileClient;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties(FileClientProperties.class)
public class FileClientConfig {
    @Bean
    public FileClient fileClient(FileClientProperties fileClientProperties) {
        switch (fileClientProperties.getType()) {
            case "OBS":
                return new HwOBSFileClient(fileClientProperties);
            case "OSS":
                return null;
            default:
                throw new SecurityException("错误操作！");
        }
    }
}
